package edu.lingnan.lmlibrary.controller;

import edu.lingnan.lmlibrary.common.JSONResult;
import edu.lingnan.lmlibrary.dto.Student;
import edu.lingnan.lmlibrary.service.StudentService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/student")
@CrossOrigin
public class StudentController {
    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    private StudentService studentService;
    @ApiOperation("注册学生")
    @PostMapping("/register")
    public JSONResult register(@RequestBody Student student){

        return studentService.registerStudent(student.getNo(),student.getName(), student.getPassword(), restTemplate);
    }
}
